package com.ihunanren.biz.common;

import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

/**
 * @author kalman03
 */
public class SpringEmail {

	private MailSender mailSender;
	private SimpleMailMessage simpleMailMessage;

	public void send(String nick, String to,String content) {
		simpleMailMessage.setTo(to);
		SimpleMailMessage message = new SimpleMailMessage(simpleMailMessage);
		message.setText(String.format(simpleMailMessage.getText(), nick, content,content,content));
		mailSender.send(message);
	}

	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}

	public void setSimpleMailMessage(SimpleMailMessage simpleMailMessage) {
		this.simpleMailMessage = simpleMailMessage;
	}
}
